
export default [
  {
    // 重定向
    path: '/',
    redirect: '/home',
    // 路由元信息
    meta: { showFooter: true }
  },
  {
    name: 'zhuye',
    path: '/home',
    // 路由懒加载
    component: () => import('@/views/Home'),
    meta: { showFooter: true }
  },
  {
    name: 'sousuo',
    // ?指定可传或不传params
    path: '/search/:keyword?',
    component: () => import('@/views/Search'),
    meta: { showFooter: true },
    /*     props($route) {
          return {
          }
        } */
  },
  {
    name: 'denglu',
    path: '/login',
    component: () => import('@/views/Login'),
    meta: { showFooter: false }
  },
  {
    name: 'zhuce',
    path: '/register',
    component: () => import('@/views/Register'),
    meta: { showFooter: false }
  },
  {
    // 需带上产品的id
    name: 'xiangqing',
    path: '/detail/:skuid',
    component: () => import('@/views/Detail'),
    meta: { showFooter: false }
  },
  {
    name: 'addcartsuccess',
    path: '/addcartsuccess',
    component: () => import('@/views/AddCartSuccess'),
    meta: { showFooter: true }
  },
  {
    name: 'shopcart',
    path: '/shopcart',
    component: () => import('@/views/ShopCart'),
    meta: { showFooter: true }
  },
  {
    name: 'trade',
    path: '/trade',
    component: () => import('@/views/Trade'),
    meta: { showFooter: false },
    // 路由独享守卫
    beforeEnter: (to, from, next) => {
      if (from.path === '/shopcart') {
        next()
      } else {
        next(false)
      }
    }
  },
  {
    name: 'pay',
    path: '/pay',
    component: () => import('@/views/Pay'),
    meta: { showFooter: false },
    // 路由独享守卫
    beforeEnter: (to, from, next) => {
      if (from.path === '/trade') {
        next()
      } else {
        next(false)
      }
    }
  },
  {
    name: 'paysuccess',
    path: '/paysuccess',
    component: () => import('@/views/PaySuccess'),
    meta: { showFooter: false },
    // 路由独享守卫
    /*   beforeEnter: (to, from, next) => {
        if (from.path === '/pay') {
          next()
        } else {
          next(false)
        }
      } */
  },
  {
    name: 'center',
    path: '/center',
    component: () => import('@/views/Center'),
    meta: { showFooter: false },
    children: [
      // 重定向
      {
        path: '/center',
        redirect: '/center/myorder'
      },
      {
        name: 'myorder',
        path: 'myorder',
        component: () => import('@/views/Center/myOrder'),
      },
      {
        path: 'grouporder',
        component: () => import('@/views/Center/groupOrder'),
      }
    ]
  }
]